Skip to content

fix(kernel): decode a failed async status poll into the driver error - #608

Open
vuanhphung wants to merge 1 commit into
mainfrom
fix/kernel-async-status-error-mapping
Open

vuanhphung wants to merge 1 commit into
mainfrom
fix/kernel-async-status-error-mapping

Conversation

@vuanhphung

Copy link
Copy Markdown
Collaborator

On the kernel backend, a failed status poll on a runAsync: true statement reaches the caller as a raw Error whose message is the binding's internal envelope, e.g. __databricks_error__:{"code":"Internal","httpStatus":500,"message":"HTTP 500: Internal Server Error"}. waitUntilReady() and status() await AsyncStatement.status() directly (lib/kernel/KernelOperationBackend.ts:429, :627), while every other napi call on this path goes through decodeNapiKernelError. Found by the databricks-driver-test RESULTFETCH-013 SEA test (a persistent HTTP 500 on GetStatementStatus) against main 7be705e.

This routes both calls through one pollAsyncStatus() helper that decodes the rejection. The error becomes the mapped driver error (HiveDriverError: HTTP 500: Internal Server Error with the bounded cause), and its SQLSTATE and kernelMetadata are preserved like on the fetch path.

Verification: a new unit test in tests/unit/kernel/execution.test.ts fails on main (expected Error: __databricks_error__:{"code":"Inte… to be an instance of HiveDriverError) and passes with the fix. npm test (1752 passing), npm run lint, npm run prettier and npm run type-check are clean. Live, the RESULTFETCH-013 SEA test (databricks/databricks-driver-test#2068) now reports HTTP 500: Internal Server Error instead of the envelope.

This pull request and its description were written by Isaac.

On a runAsync: true statement, waitUntilReady() and status() awaited the napi AsyncStatement.status() without decodeNapiKernelError, so a failed poll (for example, retries exhausted on HTTP 500) reached the caller as a raw Error whose message is the __databricks_error__:{...} envelope. Decode it like the other napi calls.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com>

@peco-review-bot peco-review-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No issues identified by the review bot.

This branch was previously deployed

1 inactive deployment
azure-prod — 548eb211 Deployed Nov 13, 2026 by vuanhphung via e2e-test (24.22.1, 24_22_1) #2000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant